<?php
defined('o') || exit('404 not find file'); //防跳墙

// 单例模式读取配置文件
final class config {
	private static $data = array();
	private static $self = null; 
	// 读取配置文件
	final private function __construct() {
		self :: update();
	} 
	// 创建对象
	public static function create() {
		if (self :: $self === null) {
			self :: $self = new self();
			return self :: $self;
		} else {
			return self :: $self;
		} 
	} 
	// 读取配置
	final function __get($name) {
		return self :: $data[$name];
	} 
	// 动态设置配置
	final function __set($key, $value) {
		echo $key, '|', $value;
		self :: $data[$key][key($value)] = $value[key($value)];
	} 
	// 动态更新
	public static function update() {
		require_once(ROOT . '//config//config.php');
		self :: $data = $configs;
	} 

	private function __clone() {
		// 防止克隆对象
	} 
} 

?>